导出格式整合
try
{
string pdffilename = fileName;
PdfReader pdfReader = new PdfReader(pdffilename);
int numberOfPages = pdfReader.NumberOfPages;
StringBuilder text = new StringBuilder();
for (int i = 1; i <= numberOfPages; i)
{
text.Append(iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(pdfReader, i)) ;
}
pdfReader.Close();
this.textBox1.Text = text.ToString();
a = pdffilename;
string name="获取文本.txt";
File.WriteAllText(name, text.ToString());
System.Diagnostics.Process.Start("获取文本.txt");
return text.ToString();
}
catch (Exception ex)
{
return "原因:" ex.ToString();
}
评论